﻿using Avalonia.Controls;

namespace WeatherCore.App.Dialogs;

public partial class CityChoose : UserControl
{
    public CityChoose()
    {
        InitializeComponent();
        HotList.ItemsSource = sourceArray;
        //Box.ItemsSource = sourceArray.OrderBy(x => x);
    }

    private static readonly string[] sourceArray =
    [
        "北京", "上海", "广州", "苏州", "沈阳",
        "杭州", "武汉", "西安", "重庆", "厦门",
        "上海", "长沙", "济南", "郑州", "深圳",
        "南京", "青岛", "成都", "大连", "新加坡"
    ];

    private void HotListSelectionChanged(object? sender, SelectionChangedEventArgs e)
    {
        if (e.AddedItems[0] is not string s) return;
        Box.Text = s;
    }
}